package com.qys.livesMall.app.user.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qys.livesMall.app.user.model.dto.app.AppUserRechargeDTO;
import com.qys.livesMall.app.user.model.dto.app.AppUserWithdrawalsDTO;
import com.qys.livesMall.app.user.model.dto.rw.AuditRw;
import com.qys.livesMall.app.user.model.dto.sys.*;
import com.qys.livesMall.app.user.model.entity.H2AppUserRechargeWithdrawals;
import com.qys.livesMall.app.user.model.vo.WithdrawalsStatisticsVO;
import com.qys.livesMall.app.user.model.vo.app.WithdrawalsConfigVO;
import com.qys.livesMall.app.user.model.vo.sys.AppUserRWRankingVO;
import com.qys.livesMall.app.user.model.vo.sys.RechargStatisticsStateVO;
import com.qys.livesMall.app.user.model.vo.sys.RechargStatisticsVO;
import com.qys.livesMall.app.user.model.vo.sys.UserRWChannelStatisticsVO;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.framework.view.BaseQuery;

import java.math.BigDecimal;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 用户充值 服务类
 * </p>
 *
 * @author dp
 * @since 2023-04-27
 */
public interface IH2AppUserRechargeWithdrawalsService extends IService<H2AppUserRechargeWithdrawals> {

    /**
     * 用户充值
     *
     * @param rechargeDTO
     */
    void recharge(AppUserRechargeDTO rechargeDTO);

    /**
     * 分页查询用户充值信息
     *
     * @param pageDTO
     * @return
     */
    Page<H2AppUserRechargeWithdrawals> page(SysUserRechargePageDTO pageDTO);

    /**
     * 审核用户申请信息
     *
     * @param id
     * @param remark 审核不通过备注
     * @param amount 实际金额
     */
    @Deprecated
    void audit(String id, String remark, BigDecimal amount,int type);

    /**
     *
     * @param auditRw
     * @return
     */
    R auditPass(AuditRw auditRw);

    R auditNoPass(AuditRw auditRw);

    /**
     * app用户提现
     *
     * @param withdrawalsDTO
     */
    void withdrawals(AppUserWithdrawalsDTO withdrawalsDTO);

    /**
     * 查询充值提现已审核的数据
     * @param ids
     * @return
     */
    List<H2AppUserRechargeWithdrawals> listAgreeByIds(List<Long> ids);

    /**
     * 查询待审核提现数据
     * @param ids
     * @return
     */
    List<H2AppUserRechargeWithdrawals> getlistWaitByIds(List<Long> ids);

    Page<RechargStatisticsVO> rechargePage(RechargStatisticsPage pageDTO);

    Page<WithdrawalsStatisticsVO> withdrawalsPage(WithdrawalsStatisticsPage pageDTO);

    List<H2AppUserRechargeWithdrawals> getYesterday();

    Integer WithdrawalstByUserIds(List<String> list, int i);

    BigDecimal getAuditWithdrawal(SysHomeStatisticsDTO dto);

    /**
     * 今天发起的
     * @param userSysType
     * @return
     */
    BigDecimal getInitiateWithdrawal(Integer userSysType);

    /**
     * 今天充值和提现的数据
     * @return
     */
    List<H2AppUserRechargeWithdrawals> getTodayData(Integer userSysType);

    /**
     * 充值的总人数
     * @return
     */
    Integer gettotalRechargePeoplecount(Integer userSysType);

    BigDecimal getAuditWithdrawalByUserids(List<Long> userids);

    /**
     * 店铺的待审核提现
     * @param userids
     * @return
     */
    BigDecimal getAuditShopWithdrawalByUserids(List<Long> userids);

    /**
     * 用户邀请充值过的下级
     * @param userIdList
     * @return
     */
    List<Long> getChildInfo(List<Long> userIdList);

    /**
     * 复冲金额
     * @param userIdAll
     * @return
     */
    BigDecimal getRechargeAmount(List<Long> userIdAll);

    /**
     * 用户充值总金额
     * @param userIdAll
     * @return
     */
    BigDecimal getthreewithdrawalAmount(List<Long> userIdAll);

    BigDecimal getTeamRechargeAmount(List<String> subordinateUserIds);

    RechargStatisticsStateVO rechargeState(RechargStatisticsPage pageDTO);

    List<UserJuniorInfoVO> getJuniorInfo(List<Long> userIds);

    WithdrawalsConfigVO getWithdrawalsConfig(Long userId);

    Page<AppUserRWRankingVO> rwrankingPage(BaseQuery baseQuery);

    List<UserRWChannelStatisticsVO> getRWChannelStatistics();

    /**
     * 昨天全部充值提现数据
     * @return
     */
    List<H2AppUserRechargeWithdrawals> getYesterdayRwDate(Integer userSysType);

     void convertRW(Set<Long> userIdAll, UserJuniorInfoVO shopJuniorInfoVO);

    H2AppUserRechargeWithdrawals getEarliestRechargeBYUserId(Long userId);
}
